import java.util.Scanner;

public class Practice1113 {
    //有假币
    public static long count3(long n){
        if(n==1){
            return 0;
        }
        if(n==2||n==3){
            return 1;
        }


        long metage,rest,times=0;
        // 3等分前，先加2，使得metage的值尽量大于rest
        // (metage,metage,rest)
        metage = (n+2)/3;
        rest = n-2*metage;

        times= 1 + count3(Math.max(metage, rest));
        return times;
    }
    public static void main(String[] args){
        Scanner scan= new Scanner(System.in);
        while(scan.hasNext()){
            long n=scan.nextLong();
            if(n==0) break;
            long count=count3(n);
            System.out.println(count);
        }
    }
}
